import request from '@/config/axios'

// 商家银行账户 VO
export interface MerchantBankVO {
  id: number // 主键ID
  merchantId: number // 商家ID
  accountName: string // 账户名称
  accountNumber: string // 账号
  bankName: string // 银行名称
  branchName: string // 支行名称
  isDefault: string // 是否默认账户
  status: number // 状态
}

// 商家银行账户 API
export const MerchantBankApi = {
  // 查询商家银行账户分页
  getMerchantBankPage: async (params: any) => {
    return await request.get({ url: `/juliang/merchant-bank/page`, params })
  },

  // 查询商家银行账户详情
  getMerchantBankById: async (id: number) => {
    return await request.get({ url: `/juliang/merchant-bank/getById?id=` + id })
  },

  // 新增商家银行账户
  createMerchantBank: async (data: MerchantBankVO) => {
    return await request.post({ url: `/juliang/merchant-bank/create`, data })
  },

  // 修改商家银行账户
  updateMerchantBank: async (data: MerchantBankVO) => {
    return await request.post({ url: `/juliang/merchant-bank/update`, data })
  },

  // 修改商家银行账户状态
  updateMerchantBankStatus: async (id: number, status: number) => {
    const data = {
      id,
      status
    }
    return await request.post({ url: `/juliang/merchant-bank/updateStatus`, data: data })
  },

  // 删除商家银行账户
  deleteMerchantBankById: async (id: number) => {
    return await request.get({ url: `/juliang/merchant-bank/delete?id=` + id })
  },

  // 导出商家银行账户 Excel
  exportMerchantBank: async (params) => {
    return await request.download({ url: `/juliang/merchant-bank/export-excel`, params })
  },
}
